<template>
    <div id="bigDiv">
        <head-2 />
        <div id="bigTitle">符号大判官</div>
        <div id="contentDiv">
            <div id="zhuangtai"><span>正确：</span><span id="duiCount">0</span><span>错误：</span><span id="cuoCount">0</span>
            </div>
            <div id="question">
                <div id="zuo">0</div><input type="button" value="?" id="fuhao" />
                <div id="you">0</div>
                <div id="dengyu">=</div>
                <div id="end">0</div>
            </div>
            <div id="kuang">
                <button class="btnfuhao">+</button>
                <button class="btnfuhao">-</button>
                <button class="btnfuhao">x</button>
                <button class="btnfuhao">÷</button>
            </div>
            <div id="jiesao">
                <p>开口方向不同：大于号开口方向是这样的＞，小于号开口方向是这样的＜。二者名字不同：大于号的名字是大于号，小于号的名字是小于号。二者表示含义含义不同。</p>
            </div>
            <div id="GameOver" v-if="isEnd">
            <div id="endTittle">游戏结束</div>
            <div>
                <img src="https://pic2.imgdb.cn/item/644a7a5e0d2dde5777f7ad9f.jpg" alt="" />
                <p>{{ res }}</p>
            </div>
            <div id="btn">
                <el-button type="success" size="small" @click="onceAgain">再来一次</el-button>
                <el-button type="success" size="small" @click="goBack">返回首页</el-button>
                <el-button type="success" size="small" @click="lookEnd">查看结果</el-button>
            </div>
        </div>
        </div>
    </div>
</template>
  
<script>
import aes from "@/utils/aes";
import head2 from '@/components/Head/head2.vue'
export default {
    components: { head2 },
    data() {
        return {
            countDwon: 10,
            isEnd:false,
        }
    },
    mounted() {
        this.getChar()
        // this.test()
    },
    methods: {
        onceAgain(){
            this.isEnd=!this.isEnd
        },
        goBack(){
            this.$router.push("/home")
        },
        lookEnd(){
            this.isEnd=!this.isEnd
        },
        getChar() {
            var arrfuhao = ["+", "-", "x", "÷"]
            var zuozhi = document.getElementById("zuo");//获取左边的值
            var youzhi = document.getElementById("you");//获取右边的值
            var daAn = document.getElementById("end")//获取结果
            var btn = document.getElementsByClassName("btnfuhao")//获取是个符号
            var allArr = [];//获取全部题
            var duiArr = [];//存储对的题个数
            var cuoArr = [];//存储错的题个数
            var duiNumber = document.getElementById("duiCount")//获取对的数量
            var cuoNumner = document.getElementById("cuoCount")//获取错的数量
            var tonguo = document.getElementById("over");
            var duiGeShu = document.getElementById("passCount");
            var cuoGeShu = document.getElementById("overCount");
            var fenshu = document.getElementById("fen");
            var zailaiyici = document.getElementById("agine");
            shuiji()

            function shuiji() {//给界面赋值（80？00=？）
                var count = Math.floor(Math.random() * 4)
                allArr.push(count)
                var firstNumber = Math.floor(Math.random() * 100);
                var secondNumber = Math.floor(Math.random() * 100);
                switch (arrfuhao[count]) {
                    case "+":
                        zuozhi.innerHTML = firstNumber;
                        youzhi.innerHTML = secondNumber;
                        daAn.innerHTML = firstNumber + secondNumber;
                        break;
                    case "-":
                        if (firstNumber > secondNumber) {
                            zuozhi.innerHTML = firstNumber;
                            youzhi.innerHTML = secondNumber;
                            daAn.innerHTML = firstNumber - secondNumber
                        }
                        else {
                            zuozhi.innerHTML = secondNumber;
                            youzhi.innerHTML = firstNumber;
                            daAn.innerHTML = secondNumber - firstNumber
                        }
                        break;
                    case "x":
                        zuozhi.innerHTML = firstNumber;
                        youzhi.innerHTML = secondNumber;
                        daAn.innerHTML = firstNumber * secondNumber
                        break;
                    case "÷":
                        zuozhi.innerHTML = firstNumber * secondNumber;
                        youzhi.innerHTML = secondNumber;
                        daAn.innerHTML = firstNumber * secondNumber / secondNumber
                }
            }
        },
    }
}
</script>
  
<style lang="less" scoped>
#GameOver{
    width: 80vw;
    height: 65vh;
    background-color: rgb(171, 175, 171);
    z-index: 100;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
    #btn{
        display: flex;
        justify-content: space-around;
        bottom: 0;
    }
}
#name {
    margin-top: 20px;
    font-size: 20px;
    color: white;
    text-align: center;
    letter-spacing: 2px;
}

#kuang {
    margin-top: 44vh;
    margin-left: -1vw;
    display: flex;
    width: 100vw;
    height: 10vh;
    flex-wrap: wrap;
    justify-content: center;
}

#kuang>button {
    flex: 1;
    font-size: 20px;
    margin: 0 18px;
}

#jiesao>p {
    position: absolute;
    bottom: 10vh;
    color: white;
    font-size: 16px;
    width: 98vw;
    margin: 0 auto;
    height: 10vh;
}

#over {
    background-color: #6b778d;
    position: absolute;
    top: 10vh;
    height: 75vh;
    width: 80vw;
    left: 10vw;
    color: white;
    display: none;
}

#over>p:nth-child(1) {
    text-align: center;
    font-size: 18px;
}

#over>p:nth-child(2) {
    text-align: center;
    font-size: 18px;
}

#over>span {
    font-size: 18px;
    margin-top: 10vh;
}

#anNiu {
    margin-top: 12vh;
    display: flex;
    justify-content: center;
    margin-left: -3vw;
}

#anNiu>button {
    margin-left: 2rem;
    font: size 18px;
    ;
    height: 5.5vh;
    width: 22vw;
}

#kongge {
    height: 5vh;
}

#fen {
    font-size: 30px;
    margin: 2.5vh 25vw;
    color: red;
}

#question {
    width: 100vw;
    height: 30vh;
    background-color: #1687a7;
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);
    font-size: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#fuhao {
    width: 15vw;
    height: 15vw;
    font-size: 30px;
}

#zuo,
#you,
#end,
#dengyu {
    color: white;
    margin: 0 10px;
}

#zhuangtai {
    width: 100vw;
    height: 5vh;
    font-size: 22px;
    margin-top: 2vh;
    color: red;
    display: flex;
    justify-content: center;
    line-height: 5vh;
}

#zhuangtai>span:nth-child(1),
#duiCount {
    color: #5bd1d7;
}

#zhuangtai>span {
    flex: 1;
    margin-left: 5vw;
}

#show {
    font-size: 20px;
    top: 10vh;
}

#bigDiv {
    height: 100vh;

    #countDown {
        font-size: 18px;
        font-weight: bold;
        margin-top: 30px;
        letter-spacing: 2px;

        #timeNumber {
            color: red;
        }
    }

    #bigTitle {
        font-weight: bold;
        font-size: 22px;
        margin-top: 5px;
        margin-bottom: 5px;
        letter-spacing: 3px;
    }

}</style>